package xyz.hubery.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import xyz.hubery.model.R;
import xyz.hubery.service.LoginService;
import xyz.hubery.vo.LoginForm;
import xyz.hubery.vo.LoginUser;

@RestController
@Api(tags = "登录控制器")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    @ApiOperation("登录")
    public R<LoginUser> login(@RequestBody LoginForm loginForm) {
        LoginUser loginUser =  loginService.login(loginForm);
        return R.ok(loginUser);
    }
}
